package com.flyme.module.base.provider.service.impl;

import com.flyme.common.core.model.query.CriteriaQuery;
import com.flyme.common.core.model.query.PagerInfo;
import com.flyme.common.core.model.query.PqGrid;
import com.flyme.core.base.supper.entity.EntityMap;
import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.base.client.entity.SysQuestion;
import com.flyme.module.base.provider.mapper.SysQuestionMapper;
import com.flyme.module.base.provider.service.SysQuestionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: zyf
 * @date: 2018/10/24 16:33
 * @description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysQuestionServiceImpl extends BaseServiceImpl<SysQuestionMapper, SysQuestion> implements SysQuestionService {

    /**
     * 查询所有问题
     */
    public List<SysQuestion> selectAll(){
        return list(q().eq("questionStatus", 1).orderByAsc("questionOrder"));
    }

    /**
     * 网站查询所有问题
     */
    public PqGrid selectAllWeb(PagerInfo pagerInfo){
        CriteriaQuery queryWrapper = new CriteriaQuery<EntityMap>(pagerInfo);
        queryWrapper.select("*");
        queryWrapper.eq("questionStatus", 1);
        queryWrapper.orderByAsc("questionOrder");
        return pageList(queryWrapper);
    }

}
